package cn.com.jrr.core.controller.email;

import java.util.logging.Logger;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/email")
public class SendEmailController {
    private static final Logger logger = Logger.getLogger("SendEmailController");
    //@Resource
    //EmailService emailService;
    @Resource
    private JavaMailSender javaMailSender;
    @RequestMapping("sendEmail")
    public void sendEmail() {
        logger.info("-------------执行发送邮件START---------------");
        SimpleMailMessage sm=new SimpleMailMessage();
        sm.setTo("980804239@qq.com");
        sm.setFrom("18298498823@163.com");
        sm.setSubject("ceshi");


        //写入excel
        //insuranceService.excelManage();
        //发邮件
        //emailService.emailManage();

        for(int i=0;i<20;i++){
            sm.setText("哈哈哈哈哈哈："+i);
            javaMailSender.send(sm);
        }
        logger.info("-------------执行发送邮件END---------------");

    }


}
